FROM golang:1.14.1-alpine3.11
MAINTAINER "Alan LI <macroldj@163.com>"

WORKDIR workspace
COPY ./app/* .
RUN export GO111MODULE=on\
  && export GOPROXY=https://goproxy.cn

RUN go mod init macroldj.com/echo/v1 \
&& go get && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .

FROM alpine:latest as prod
RUN apk --no-cache add ca-certificates
WORKDIR workspace
COPY --from=0 helloworld/app .
CMD ["./app"]